package com.gofaraway.mystarter.config;

import com.gofaraway.mystarter.service.YourService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ChenPeng
 * @Date 2024/9/9 14:59
 */
@Configuration
@ConditionalOnClass(YourService.class)
public class YourServiceAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public YourService yourService() {
        // 实例化并返回你的服务
        return new YourService();
    }
}
